﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.SqlClient;
using System.Windows.Forms;
using System.Data;

namespace mas_apredizaje.BD
{
    class controllogin
    {
        //***********inicio sesion 
        private conexion conn = new conexion();

        public DataSet inicioprof(string pass, string rut)
        {
            conn.conectar();
            DataSet ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter("SELECT cuenta.rut, cuenta.pass from cuenta where rut=@rut and pass=@pass", conn.conector);
            da.SelectCommand.Parameters.Add(new SqlParameter("@rut", rut));
            da.SelectCommand.Parameters.Add(new SqlParameter("@pass", pass));
            da.Fill(ds, "prof");
            conn.desconectar();
            return ds;
        }
        
        public DataSet inicioalum(string rut)
        {
            conn.conectar();
            DataSet ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter("SELECT alumno.rutAlumno, alumno.nombre from alumno where rutAlumno=@rut", conn.conector);
            da.SelectCommand.Parameters.Add(new SqlParameter("@rut", rut));            
            da.Fill(ds, "alum");
            conn.desconectar();
            return ds;
        }



    }
}
